package com.laikan.reader.core.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by Administrator on 2016/8/16.
 */
public class ShelfViewPage extends ViewPager {

    private boolean scrollble = false;

    public ShelfViewPage(Context context) {
        super(context);
    }

    public ShelfViewPage(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (scrollble) {
            requestDisallowInterceptTouchEvent(true);
        } else{
            requestDisallowInterceptTouchEvent(false);
        }
        return super.dispatchTouchEvent(ev);
    }


    public void setScrollble(boolean scrollble) {
        this.scrollble = scrollble;
    }
}